<!DOCTYPE html>
<html>
  <head>

    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/semantic-ui/2.0.7/semantic.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/google/code-prettify/master/src/prettify.css">
    <link rel="stylesheet" type="text/css" href="../examples.css">

    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="https://cdn.jsdelivr.net/semantic-ui/2.0.7/semantic.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>

    <script src="../sm-core.js"></script>
    <script src="../sm-addons.js"></script>
    <script src="sm-embed.js"></script>

    <script>
      angular.module('semantic-ui')
        .controller('MainController', function($scope) 
        {
          
        })
      ;
    </script>

  </head>
  <body ng-app="semantic-ui" ng-controller="MainController">

    <div class="ui container">

      <code class="float right optional">optional</code>
      <code class="float right required">required</code> 

      <h1 class="ui header">
        <img src="http://semantic-ui.com/images/logo.png">
        <div class="content">
          Embed Directives
          <div class="sub header">Create &amp; Control Semantic UI Embed with Angular Directives</div>
        </div>
      </h1>

      <div class="ui secondary top attached segment">
        <h3 class="ui header">
          sm-embed
          <div class="sub header">Creates an embed.</div>
        </h3>
      </div>
      <div class="ui bottom attached segment">

        <h5>Attributes</h5>
        <ul>
          <li><code class="optional">source</code> <code>@</code> a string which specifies a source to use, if no source is provided it will be determined from the domain of a specified url.</li>
          <li><code class="optional">source-id</code> <code>@</code> a string which specifies an id value to replace with the <code>{id}</code> value found in templated urls.</li>
          <li><code class="optional">url</code> <code>@</code> a string which specifies a url to use for embed.</li>
          <li><code class="optional">placeholder</code> <code>@</code> a string which is a URL to an image to display over the embedded content.</li>
          <li><code class="optional">icon</code> <code>@</code> a string which specifies an icon to use with placeholder content.</li>
          <li><code class="optional">settings</code> <code>=</code> reference to a settings object to pass to the initialization function.</li>
        </ul>
        <h5>Callback Attributes</h5>
        <ul>
          <li><code class="optional">on-init</code> <code>=</code> Callback once the module is initialized, passing the initialized element as the first argument.</li>
          <li><code class="optional">on-create</code> <code>=</code> Callback when iframe is generated.</li>
          <li><code class="optional">on-display</code> <code>=</code> Callback Whenever an iframe contents is shown.</li>
          <li><code class="optional">on-placeholder-display</code> <code>=</code> Callback immediately before Embed is removed from DOM.</li>
          <li><code class="optional">on-embed</code> <code>=</code> Callback when module parameters are determined. Allows you to adjust parameters at run time by returning a new parameters object.</li>
        </ul>

        <h5>Example</h5>

        <pre class="ui segment prettyprint lang-html" id="code0"></pre>

        <div data-copy-to="#code0">
          <sm-embed source="youtube" source-id="pfdu_gTry8E" placeholder="http://semantic-ui.com/images/image-16by9.png"></sm-embed>
        </div>

      </div>

      <div class="ui secondary top attached segment">
        <h3 class="ui header">
          sm-embed-bind
          <div class="sub header">A lightweight attribute directive which calls embed() on the element with the settings object passed to the attribute. Using this directive means you need to manage the communication between Angular and Semantic UI yourself.</div>
        </h3>
      </div>
      <div class="ui bottom attached segment">

        <pre class="ui segment prettyprint lang-html" id="code1"></pre>

        <div data-copy-to="#code1">
          <div class="ui embed" sm-embed-bind data-source="youtube" data-id="pfdu_gTry8E" data-placeholder="http://semantic-ui.com/images/image-16by9.png"></div>
        </div>

      </div>

      <div class="ui tertiary segment">

        <h1>Behavior Directives</h1>
        <p>These attribute directives invoke a behavior on the component where the attribute value can be one of the following formats:</p>

        <h5>String</h5>
        <ul>
          <li>Selector to the dropdown(s) to invoke the behavior when the element with the directive is clicked.</li>
        </ul>

        <h5>Object</h5>
        <ul>
          <li><code class="required">$</code> <code>@</code> A selector string.</li>
          <li><code class="optional">evt</code> <code>@</code> The event string which triggers the behavior ('click' by default).</li>
          <li><code class="optional">enabled</code> <code>=</code> A boolean value which determines whether or not the behavior should be called when the event occurs.</li>
          <li><code class="optional">value</code> <code>=</code> The first argument to pass to the behavior if it requires one.</li>
        </ul>

        <h5>Example</h5>

        <pre class="ui segment prettyprint lang-html" id="code2"></pre>

        <div data-copy-to="#code2">
          <sm-button class="teal" sm-embed-behavior="'selector'">Execute Simple Behavior</sm-button>
          <sm-button class="teal" sm-embed-behavior="{$: 'selector', value: scopeValue1, enabled: scopeValue2, evt: 'mouseover'}">Execute Advanced Behavior</sm-button>
        </div>

      </div>

      <div class="ui secondary top attached segment">
        <h3 class="ui header">
          sm-embed-show / sm-embed-hide / sm-embed-reset / sm-embed-destroy
          <div class="sub header">When a DOM event fires on the element with the directive, it can command embed(s) to execute a behavior.</div>
        </h3>
      </div>
      <div class="ui bottom attached segment">

        <pre class="ui segment prettyprint lang-html" id="code3"></pre>

        <div data-copy-to="#code3">
          <sm-button sm-embed-show="'.embed3'" class="teal">Show</sm-button>
          <sm-button sm-embed-hide="'.embed3'" class="teal">Hide</sm-button>
          <sm-button sm-embed-reset="'.embed3'" class="teal">Reset</sm-button>
          <sm-button sm-embed-destroy="'.embed3'" class="teal">Destroy</sm-button>
          <br><br>
          <sm-embed class="embed3" source="vimeo" source-id="125292332" placeholder="http://semantic-ui.com/images/vimeo-example.jpg"></sm-embed>
        </div>

      </div>

    </div>

    <script src="../examples.js"></script>

  </body>
</html>